<!DOCTYPE html>
<!-- saved from url=(0071)http://www.uphsh.com/wap/ef73d9dc381d412f964b99e521c270a6/invoice/addUI -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--<base href="http://www.uphsh.com:80/">--><base href=".">
<title>新户注册</title>


<meta name="description" content="新户注册">
<meta name="keywords" content="新户注册">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">

	<link type="text/css" href="../../resource/xhzc/wapcommon.css" rel="stylesheet">
	<link rel="stylesheet" href="../../resource/weuimin.css"/>
	<script src="../../resource/jquery1.js"></script>
	<script type="text/javascript" src="../../resource/common.js"></script>
	<script src="../../resource/tjxxfiles/jquery180min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../resource/tjxxfiles/wapcommon.js"></script>
    <script src="../../script/api.js"></script>
    <script type="text/javascript" src="../../script/aes.js"></script>
	<script type="text/javascript" charset="UTF-8" src="../../script/naes.js"></script>
	<script type="text/javascript" src="../../script/modeecb.js"></script>
    <script type="text/javascript" src="../../script/tmd5.js"></script>
    <script type="text/javascript" src="../../script/constants.js"></script>

		<script type="text/javascript" src="../../resource/xhzc/my.js"></script>
	<style>
		#scale{
		background: transparent none;
		color: rgb(0, 0, 0);
		width: 10%;
		line-height: 20px;
		text-indent: 8px;
		height: 20px;
		margin-top: 10px;
		margin-right: 0px;
		margin-left: 15px;
		vertical-align: baseline;
		border: 1px solid #e0e0e0;
		}

		.formContent input[type=checkbox] {
			background: transparent none;
			color: rgb(0, 0, 0);
			width: 10%;
			line-height: 20px;
			text-indent: 8px;
			height: 20px;
			margin-top: 10px;
			margin-right: 0px;
			margin-left: 15px;
			vertical-align: baseline;
			border: 1px solid #e0e0e0;
		}


		#scalab{
		margin-bottom: 20px;
		}

		#scadd{
		margin-bottom: 20px;
		}

		.bg {
			background: #27a8fa;
			overflow: hidden;
			padding: 5px 0 15px;
			margin-left: 25px;
		}

		.center { margin: 0 auto; }
		.tc { text-align: center;color: #fff; }

		.bg input {
			background: transparent none;
			color: rgb(0, 0, 0);
			width: 90%;
			line-height: 40px;
			text-indent: 8px;
			height: 30px;
			vertical-align: baseline;
			border: 1px solid #e0e0e0;
		}

		.bg dl {
			width: 100%;
			height: 40px;
			line-height: 40px;
			clear: both;
			float: left;
			margin: 5px 0;
			position: relative;
		}

		.bg dt {
			text-align: right;
			float: left;
			margin-right: 5px;
			width: 80px;
			color: #fff;
		}

		.bg dd {
			margin-left: 85px;
			margin-right: 5px;
			display: block;
			width: auto;
		}

		.bg #jspName {
			background: white;
		}

		.product input[type='checkbox']+label::before {
		  content:'\a0';/*不换行空格*/
		  display: inline-block;
		  vertical-align: 0.2em;
		  width:1.1em;
		  height:1.1em;
		  margin-right: .2em;
		  border-radius:.2em;
		  background: silver;/*复选框的背景色*/
		  text-indent:0.15em;
		  line-height: 0.65;
		}
	.product input[type='checkbox'] {
  		/*隐藏掉原先实际的 checkbox 框，之所以没用 display:none; 这种简单直接的方式，是因为这种方法会把它从键盘 tab 键切换焦点的队列中完全删除*/
		  position: absolute;
		  clip:rect(0,0,0,0);
	}

	.product input[type='checkbox']:checked+label::before {
		  content:'\2713'; /*对号的 Unicode字符*/
		  background: yellowgreen;/*对号的颜色*/
	}

	.product input[type='text'] {
		background: transparent none;
		color: rgb(0, 0, 0);
		width: 100%;
		line-height: 40px;
		text-indent: 8px;
		height: 40px;
		vertical-align: baseline;
		border: 1px solid #e0e0e0;
	}

	.product input[type='radio']{
		width: 1.5rem;
		height: 1.5rem;
		margin: 0 4 1  3;/*margin: 0 .4rem .1rem .3rem;*/
		border: none;
		background:  no-repeat center/1.5rem 1.5rem;
	}



	</style>
</head>
<body>
   <header id="statusBar">
	<div class="header">
        <div class="return">
			<div tapmode="presshover" style="color:#fff" onclick="goback();">
							返回
					</div>
        </div>
        <div class="tittle">
    		选择产品
        </div>
    </div>
    </header>
    <div id="contant" style="height: 563px;">
	    <div id="loadingToast" style="display:none;">
        <div class="weui-mask_transparent"></div>
        <div class="weui-toast">
            <i class="weui-loading weui-icon_toast"></i>
            <p class="weui-toast__content">请稍后...</p>
        </div>
	   </div>
				<div style="margin-left:6%;margin-right:6%;margin-top:5%;color:red;">
				*请勾选您需要购买的产品,若勾选了防伪税控,则需要通过扫描税盘条码获取盘号。
				</div>
				<div class="product">
					<dl style="margin-top:0px;">
						<dt>服务产品&nbsp;:</dt>
						<dd><input id="fwsk" type="checkbox" value=""  onclick="checkPro();"/><label for="fwsk" style="margin-left:6%;" >防伪税控 </label>
								<input class="sb" id="sb" type="checkbox" value="" /><label class="sb" id="sblab" for="sb" style="margin-left:10%;">申报</label> </dd>
					</dl>
					<div class="bg" id="bg" style="width: 80%;display: none;" >
						<div>
							<dl>
							<dt>金税盘号&nbsp;:</dt>
							<dd><input type="text"  id="jspName" style="text-align:center;font-size:16px;" value="" placeholder="扫描金税盘条码获取盘号"></dd>
							<dl>
						</div>
						<div style="margin-top:3%;margin-left:14%;">
							<img id="show" class="center" src="../../resource/ystfiles/txm.png" style="display: block;">
							<p class="tc">条码扫一扫</p>
						</div>
					</div>
				</div>
				<div class="product" id="pay_pro">
					<dl>
						<dt>支付方式&nbsp;:</dt>
						<dd><input  type="radio" value="" id="bankZf" name="zffs" checked="true" style="margin-left:6%"/><label for="bankZf">银联</label>
						<input type="radio" value="" id="zfb" name="zffs" style="margin-left:6%"/><label for="zfb">支付宝</label>
						<input type="radio" value="" id="xef" name="zffs" style="margin-left:4%"/> <label for="xef">兴E付</label>
						</dd>
					</dl>
				</div>

	    	<div id="errorInfo"   style="height:20px;text-align: center;color: red;"></div>
	    <div style="padding: 0 10px;">
			<input type="button" id="btn_sub"  class="button" value="提   交" onclick="regisCus();" tapmode="presshover">
		</div>

<div class="copyright">四川航天信息有限公司<br>客户热线：<a href="tel:95113" style="color: gray;">95113</a></div>
</div>

<script>

function goback(){
   api.closeWin();
}

$("#show").click(function(){
		scanQRCode();
});

function scanQRCode(){
	var FNScanner = api.require('FNScanner');
		FNScanner.openScanner({
			autorotation: true
		}, function(ret, err) {
		setTimeout(function(){
			if(ret){
				if(ret.eventType=="success"){
					var reg=/^(44-)\d{11}$/;//金税盘号以 44- 开头,后面跟11位数字
					if (reg.test(ret.content)){
						$("#jspName").val(ret.content);
					}else{
						$("#jspName").val("");
						api.alert({
							msg: "信息获取失败,请您正确扫描金税盘!"
						});
					}
				}
			}else {
					alert(JSON.stringify(err));
			}
			},500);
		});
}

$(".product input[type='radio']").click(function(){
	//$(".product input[type='radio']").style.background="url(\"../../image/radiob.png\") no-repeat center/1.5rem 1.5rem";
	var radios = document.getElementsByName(this.name);
	for(var i = 0; i<radios.length; i++){
			if(radios[i].checked == true){
					radios[i].style.background="url(\"../../image/radiob.png\") no-repeat center/1.5rem 1.5rem";
			}else{
					radios[i].style.background="no-repeat center/1.5rem 1.5rem";
			}
	}
});
</script>

<script type="text/javascript">
var userInfoMap;
var lrway="";

var alldm = "";
var allprice = "";
var hjprice = "";
var allsl = "";
var allspmc = "";
var _openid = "";

var jspprice="";//金税盘价格
var fwskprice="";//防伪税控服务费
var sbcbprice="";//申报抄报服务费

var proArr;//产品list

apiready=function(){
    if(api.systemType == "ios"){
	   document.getElementById("statusBar").style.background = "#298cb4";
	}
    $api.fixStatusBar( $api.dom('header') );
	var rs=$(".product input[type='radio']");
	for(var i = 0; i<rs.length; i++){
			if(rs[i].checked == true){
					rs[i].style.background="url(\"../../image/radiob.png\") no-repeat center/1.5rem 1.5rem";
			}else{
					rs[i].style.background="no-repeat center/1.5rem 1.5rem";
			}
	}
	api.parseTapmode();

	api.addEventListener({
	    name: 'regis'
	}, function(ret, err) {
			$("#btn_sub").val("支     付");
	});

	/*api.addEventListener({
	name: 'keyback'
	}, function(ret, err) {
		var dialogBox = api.require('dialogBox');
		dialogBox.alert({
				texts: {
						title: '确认',
						content: '您还未购买服务,确定要退出吗?',
						leftBtnTitle: '取消',
						rightBtnTitle: '确定'
				},
				tapClose:true,
				styles: {
						bg: '#fff',
						w: 300,
						title: {
								marginT: 20,
								iconSize: 40,
								titleSize: 14,
								titleColor: '#000'
						},
						content: {
								color: '#000',
								size: 14
						},
						left: {
								marginB: 7,
								marginL: 20,
								w: 130,
								h: 35,
								corner: 2,
								bg: '#fff',
								size: 12
						},
						right: {
								marginB: 7,
								marginL: 10,
								w: 130,
								h: 35,
								corner: 2,
								bg: '#fff',
								size: 12
						}
				}
		}, function(ret) {
				if (ret.eventType == 'left') {
						//var dialogBox = api.require('dialogBox');
						dialogBox.close({
								dialogName: 'alert'
						});
				}else if(ret.eventType == 'right'){
					dialogBox.close({
							dialogName: 'alert'
					});
					/*api.closeToWin({
						 name: 'root'
					});*/
					/*api.closeWin({});

				}
		});
	});*/

	//获取产品信息
	//$("#loadingToast").show();
	var callback = function(ret, err){
		$("#loadingToast").hide();
				if (ret) {
					if(ret.success){
						proArr = eval("("+ ret.json +")");//赋值list
					}else{
						$("#btn_sub").hide();
						api.alert({
						 msg: ret.msg
					 });
					}

					/*if(data.sps.length > 0){
						for(var i=0;i<data.sps.length;i++){
						if(data.sps[i].dm=='2701T999901124'){//金税盘
								jspprice="";
						}esle if(data.sps[i].dm=='2701T999901124'){//防伪税控服务费
							  fwskprice="";
					  }else if(data.sps[i].dm=='2701T999901124'){//申报抄报服务费
								sbcbprice="";
				    }
					}
				 }else{
						 api.alert({
							msg: "服务产品信息获取失败！"
						});
			 	}*/
			 }else{
				   $("#btn_sub").hide();
					 api.alert({
						msg: "服务请求错误,请联系管理员"
					 });
			 }
	}
	var content = {"dm":"1"};
	apiAjax(JSON.stringify(content),url.shpr,callback);


	lrway=$api.getStorage("lrway");
	if(ganv(lrway)=='1'){
		userInfoMap = api.pageParam.userInfoMap;
	}else if(ganv(lrway)=='2'){
		userInfoMap = api.pageParam.userInfoMap.data;
	}

	//设置支付是否显示
	if(ganv(userInfoMap.qzd)!='1'){
			$("#pay_pro").hide();
	}

	//设置网络申报是否显示
	if(ganv(userInfoMap.qzd)=='1'&&(userInfoMap.org_name.indexOf("成都")!=-1||userInfoMap.org_name.indexOf("德阳")!=-1)){
			//$(".sb").show();
			var flag = false;
			if(userInfoMap.org_name.indexOf("成都")!=-1){
				for(var i = 0;i < sjArr[i].length; i++) {
						if(userInfoMap.zgswjgmc.indexOf(sjArr[i])!=-1){
								flag=true;
								break;
						}
				}

				if(flag){
					$(".sb").show();
				}else{
					$(".sb").hide();
				}
			}else{
				$(".sb").show();
			}
	}else{
			$(".sb").hide();
	}
}

function backhsty(){
		api.historyBack({
	  //  frameName: 'detail'
		}, function(ret, err) {
	    if (!ret.status) {
	        api.closeWin();
	    }
	});
}

function checkPro(){
	if(document.getElementById("fwsk").checked){
		//需要扫描税盘条码
		$("#bg").show();//显示扫描界面
	}else{
		$("#bg").hide();
	}

}


//注册
function regisCus(){
	var jp = $api.getStorage("dl_phone");
	if (jp == "" || jp == null || jp == "undefined" || typeof(jp) == "undefined") {
		api.alert({
			msg: '请登录'
		}, function(ret, err) {
			api.openWin({
				name: '跳转登陆',
				url: '../login.html'
			});
		});
	}else{
		//信息是否完全
		if(matchInfo()){
				//信息完善
				changeValue();//新户操作信息
				loadHt();
				var callback = function(ret, err){
							rmHt();
							if (ret) {
							if(ret.success){
								//判断是否达到起征点,若未达到则无需生成订单和支付
								if(userInfoMap.qzd=='1'){
									if(userInfoMap.pay=='3'){
										api.openWin({
											 name: '邮寄地址',
											 url: 'sendPro.html',
											 pageParam: {
													 //allPrice: hjprice,
													 zcdz:userInfoMap.zcdz,
													 lxr :userInfoMap.fddbrxm,
													 lxdh:userInfoMap.zcdlxdh,
													 rid : ret.rid,
													allspmc: allspmc,
													total: ret.total,
													pay:userInfoMap.pay,
													taxcode:userInfoMap.shxydm
											 }
									 });
								 }else{
									 //生成订单
									 loadHt();
										 var callback = function(ret1, err1){
											 rmHt();
												 if (ret1) {
															var data = eval("("+ ret1.json +")");
															//alert(data.orderid+allspmc);
															console.log("订单id:"+data.orderid);															
															api.openWin({
																 name: '邮寄地址',
																 url: 'sendPro.html',
																 pageParam: {
																 		zcdz:userInfoMap.zcdz,
																		 lxr :userInfoMap.fddbrxm,
																		 lxdh:userInfoMap.zcdlxdh,
																 		rid : ret.rid,
																		orderid: data.orderid,
																		 //allPrice: hjprice,
																		allspmc: allspmc,
																		total: ret.total,
																		pay:userInfoMap.pay,
																		taxcode:userInfoMap.shxydm
																 }
														 });
												 } else {
														 api.alert("提交失败！");
												 }
										 }

										 var content = {"spdm":rm(alldm),"hj":hjprice,"price":rm(allprice),"sl":rm(allsl),"userid":_openid};
										 //var content = {"spdm":"2701T230901041","hj":"180","price":"180.00","sl":"1","userid":_openid};
										 //var content = {"spdm":"2701T230101002,F1150020020","hj":"480","price":"280.00,200","sl":"1,1","userid":_openid};
										 apiAjax(JSON.stringify(content),url.zctjurl,callback);
								 }
							 }else{
							 		api.alert({
									 	msg: '保存成功！',
									 	buttons: ['确定']
									});

									api.closeToWin({
										name: 'root'
									});
							 }

							}else{
										api.alert({
										 msg: ret.msg
										});
							}
						 }else{
							 api.alert({
								msg: "服务请求错误,请联系管理员"
							 });
						 }
				}
				var parameter = {"userInfoMapJson":userInfoMap};
				apiAjax(JSON.stringify(parameter),url.svrg,callback);

		}
	}
}


function matchInfo(){
	if(!document.getElementById("fwsk").checked&&!document.getElementById("sb").checked){
		api.alert({
		 msg: "请选择勾选服务产品!"
		});
		return false;
	}else if(document.getElementById("fwsk").checked&&!boolValue($("#jspName").val().trim())){
			api.alert({
			 msg: "请扫描金税盘获取盘号!"
			});
			$("#jspName").focus();
			return false;
	}else{
			return true;
	}
}

//获取客户操作信息
function changeValue(){
	alldm = "";
	allprice = "";
	hjprice = "";
	allsl = "";
	allspmc = "";
	_openid = $api.getStorage('openid');

	//修改客户可以操作的项
	var price=0;//价格
	//服务产品(防伪税控和申报)
	if(document.getElementById("fwsk").checked){
		userInfoMap.fwsk=ganv("1");
		userInfoMap.fwskprice=getProIn('2701T230101002','price');
		//userInfoMap.fwskprice="280";
		userInfoMap.jspprice=getProIn('F1150020020','price');
		//userInfoMap.jspprice="200";
		price+=(parseFloat(getProIn('2701T230101002','price'))+parseFloat(getProIn('F1150020020','price')));//一年服务费+金税盘价格200
		//price+=480;
		//金税盘号
		userInfoMap.jsph=ganv($("#jspName").val());

		alldm=alldm+'2701T230101002,F1150020020,';
		allprice = allprice+getProIn('2701T230101002','price')+","+getProIn('F1150020020','price')+",";
		allsl=allsl+"1,1,";
		allspmc=allspmc+getProIn('2701T230101002','mc')+","+getProIn('F1150020020','mc')+",";
	}else{
		userInfoMap.fwsk=ganv("0");
		userInfoMap.fwskprice="";
		userInfoMap.jspprice="";
		userInfoMap.jsph="";
	}
	//申报
	if(document.getElementById("sb").checked){
		userInfoMap.sb=ganv("1");
		userInfoMap.sbcbprice=getProIn('2701T230901041','price');
		price+=parseFloat(getProIn('2701T230901041','price'));//申报180一年

		alldm=alldm+'2701T230901041,';
		allprice=allprice+getProIn('2701T230901041','price')+",";
		allsl=allsl+"1,",
		allspmc=allspmc+getProIn('2701T230901041','mc')+",";
		//userInfoMap.sbcbprice="180";
		//price+=180;

	}else{
		userInfoMap.sb=ganv("0");
		userInfoMap.sbcbprice="";
	}

	//产品价格
	userInfoMap.price=ganv(price);
	hjprice=price.toString();
	//支付方式
	//是否达到起征点,若未达到起征点,则支付方式默认为空
	if(ganv(userInfoMap.qzd)=='1'){
		if($("#bankZf").is(":checked")){
			userInfoMap.pay=ganv("1");
			//userInfoMap.yxbz="1";
		}else if($("#zfb").is(":checked")){
			userInfoMap.pay=ganv("2");
			//userInfoMap.yxbz="1";
		}else if($("#xef").is(":checked")){
			userInfoMap.pay=ganv("3");
			//若选择刷卡方式则默认为有效,其余都为无效，只有付款过后才有效
			//userInfoMap.yxbz="1";
		}
	}
	userInfoMap.yxbz="1";//默认有效

}

//获取产品属性
function getProIn(dm,name){
		for(var i=0;i<proArr.length;i++){
				if(proArr[i].dm==dm){
					if(name=='mc'){
						return proArr[i].mc
					}else if(name=='dm'){
						return proArr[i].dm
					}else if(name=='price'){
					  return proArr[i].price
					}
				}
		}
}

//去除末尾,号
function rm(str){
		if(str.charAt(str.length-1)==","){
				str=str.substr(0, str.length - 1);
		}
		return str.toString();
}
</script>

</body></html>
